package package06章_面向对象编程_基础._07encapsulation封装性.exer2;/**
 * ClassName: book
 * Package: package06章_面向对象编程_基础._07encapsulation封装性.exer2
 * Description:
 *
 * @Author lys
 * @Create 2024/2/16 20:31
 * @Version 1.0
 */

/**
 * @author lys
 * @version 1.0
 * @description: TODO
 * @date 2024/2/16 20:31
 */
public class Book {
    private String bookName; //书名
    private String author; //作者
    private double price; //价格

    {
        System.out.println(bookName);
        if (bookName == "剑指Java" || bookName == "" || null == bookName) {
            System.out.println("----------剑指Java or '' or null------");
        }
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public String getBookName() {
        return bookName;
    }

    public void setBookName(String bn) {
        bookName = bn;
    }

    public String getAuthor() {
        return author;
    }

    //获取读书信息
    public String showInfo() {
        return "bookName : " + bookName + ", author : " + author + ", price : " + price;
    }
}
